home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sun Solutions 1997 April to September
/
Sun Solutions CD - APR '97 - SEP '97 (704-3778-12 Rev. H)(Sun Microsystems, Inc.)(1997).iso
/
products
/
bin
/
repit.pl
< prev
next >
Wrap
Perl Script
|
1996-09-13
|
2KB
|
49 lines
#!/usr/lab/bin/perl
$startdir = "/cdware/CDware/.products";
chdir($startdir);
open (LOG,">/tmp/logfile") || die " ERROR: Could not create /tmp/logfile";
foreach $dir (`ls -d Cafe*`) {
chop;
chop($dir);
print "\n Modifying $dir ...\n";
print LOG "\nModifying $dir ..\n";
foreach $_ (`find $dir -name .wais -prune -o -name .bin -prune -o -name "*.html" -print -o -name "*.htm" -print -o -name "*.map" -print -o -name "*.HTML" -print -o -name "*.HTM" -print`) {
#foreach $_ (`find $dir -name .wais -prune -o -name .bin -prune -o -name "*.HTML" -print -o -name "*.HTM" -print`) {
open (OUT,">/tmp/tmpfile") || die " ERROR: Could not create /tmp/tmpfile";
$file = $_;
chop($file);
$comp_name = $_ ;
$comp_name =~ s/^\.\/([^\/]*).*/\1/g;
#print LOG "$file:\n";
open(FILE,"$_");
while(<FILE>) {
$tmp = $_;
unless ($_ =~ "localhost:7999") {
$tmp =~ s/(\<\s*[aA].*href\s*=[^hH]*|\<\s*[aA].*HREF\s*=[^hH]*)http:\/\/([^" >]*)|(\<\s*[aA].*href\s*=[^hH]*|\<\s*[aA].*HREF\s*=[^hH]*)HTTP:\/\/([^" >]*)/\1\3http:\/\/xm.com\/cgi-bin\/redir\.pl\?\2\4+$dir/g;
#$tmp =~ s/(\<.*[aA].*href.*|\<.*[aA].*HREF.*)http:\/\/([^" >]*)|(\<.*[aA].*href.*|\<.*[aA].*HREF.*)HTTP:\/\/([^" >]*)/\1\3http:\/\/xm.com\/cgi-bin\/redir\.pl\?\2\4+$dir/g;
#print LOG $tmp unless $tmp !~ "redir.pl";
#print $tmp unless $tmp !~ "redir.pl";
}
print OUT $tmp;
}
close(FILE);
close(OUT);
print " filename: $file\n";
system "mv /tmp/tmpfile $file";
#unlink ("/tmp/tmpfile");
}
}
close(LOG);